<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>checkout</title>
	<link rel="stylesheet" href="/internship_tp/Application/Home/View/Public/style/style.css">
	<script type="text/javascript" src="/internship_tp/Application/Home/View/Public/js/jquery.min.js"></script>
	<script type="text/javascript" src="/internship_tp/Application/Home/View/Public/js/main.js"></script>
	<script type="text/javascript" src="/internship_tp/Application/Home/View/Public/js/Calculate.js"></script>
	<script type="text/javascript" src="/internship_tp/Application/Home/View/Public/js/ajaxChange.js"></script>
</head>
<body style="background:#F5F5F5;">
	<script type="text/javascript" src="/internship_tp/Application/Home/View/Public/js/requ.js"></script>
	<div class="checkout-header">
		<a href="<?php echo U('Index/index');?>" class="logo"></a>
		<h1>我的购物车</h1>
		<p>温馨提示：产品是否购买成功，以最终下单为准哦，请尽快结算</p>
		<a href="javascript:;">我的订单</a>
		<ul>
			<a href="javascript:;">464845645</a>
			<li><a href="javascript:;">个人中心</a></li>
			<li><a href="javascript:;">退出登录</a></li>
		</ul>
	</div>	
	<div class="checkout-container">
		<table class="table">
			<thead>
				<tr>
					<th>商品信息</th>
					<th>单价</th>
					<th>数量</th>
					<th>小计</th>
					<th>操作</th>
				</tr>
			</thead>
			<tbody>
				<?php if(is_array($model)): foreach($model as $mk=>$mv): ?><tr>
						<td>
							<img src="/internship_tp/Application/Public/Uploads/<?php echo ($mv["photourl"]); echo ($mv["photoname"]); ?>" alt="" style="width: 80px;height: 80px">
							<p><?php echo ($mv["name"]); ?>&nbsp;&nbsp;&nbsp;<?php echo ($mv["content"]); ?>&nbsp;&nbsp;&nbsp;<?php echo ($mv["color"]); ?></p>
						</td>
						<td>
							<span><?php echo ($mv["unit"]); ?>元</span>
						</td>
						<td class="button-wrap">
							<div>
								<input type="button" value="－" class="reduce" onclick="ajaxChange(<?php echo $mv['oldId']?>,<?php echo $mk+1?>,'-')">
								<input type="text" id="proCount<?php echo ($mk+1); ?>" class="pro-num" value="<?php echo ($mv["count"]); ?>">
								<input type="button" value="+" class="add" onclick="ajaxChange(<?php echo $mv['oldId']?>,<?php echo $mk+1?>,'+')">
							</div>
						</td>
						<td><span class="checkout-total" id="total<?php echo ($mk+1); ?>"><?php echo ($mv["price"]); ?>元</span></td>
						<td>
							<a href="javascript:;" class="delete">×</a>
							<input type="hidden" value="<?php echo ($mv['oldId']); ?>"  />
						</td>
					</tr><?php endforeach; endif; ?>
			</tbody>
		</table>
		
		<form action="<?php echo U('Product/showCal');?>" method="post">
		<div class="balance">
			<!-- <a href="<?php echo U('Product/showCal');?>">去结算</a> -->
			<input type="submit" value="去结算">
			<span>合计（不含运费）:<span id="allPrice"><?php echo ($allPrice); ?>.00</span>元</span>
		</div>
		</form>

		<h1>买购物车中商品的人还买了</h1>
		<?php if(is_array($recommend)): foreach($recommend as $key=>$rv): ?><div class="pro-cart">
				<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/recommend<?php echo ($rv["id"]); ?>.jpg" alt=""></a><a href="javascript:;"><?php echo ($rv["name"]); ?></a><p></p><span><?php echo ($rv["price"]); ?></span>
			</div><?php endforeach; endif; ?>
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
				<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
		<!--<div class="pro-cart">-->
			<!--<a href="javascript:;"><img src="/internship_tp/Application/Home/View/Public/images/boximg2.jpg" alt=""></a><a href="javascript:;">九号平衡车</a><p>年轻人的酷玩具，骑行遥控两种玩法</p><span>1999元起</span>-->
		<!--</div>-->
	</div>
	<div class="footer">
		<div class="footer-top">
	<ul>
		<li><a href="javascript:;">预约维修服务</a></li>
		<li><a href="javascript:;">7天无理由退货</a></li>
		<li><a href="javascript:;">15天免费换货</a></li>
		<li><a href="javascript:;">满150元包邮</a></li>
		<li><a href="javascript:;">520余家售后网点</a></li>
	</ul>
</div>
<div class="footer-center">
	<div class="footer-left">
		<ul>
			<span>帮助中心</span>
			<li><a href="javascript:;">账户管理</a></li>
			<li><a href="javascript:;">购物指南</a></li>
			<li><a href="javascript:;">订单操作</a></li>
		</ul>
		<ul>
			<span>服务支持</span>
			<li><a href="javascript:;">售后政策</a></li>
			<li><a href="javascript:;">自主服务</a></li>
			<li><a href="javascript:;">相关下载</a></li>
		</ul>
		<ul>
			<span>线下门店</span>
			<li><a href="javascript:;">小米之家</a></li>
			<li><a href="javascript:;">服务网点</a></li>
			<li><a href="javascript:;">零售网点</a></li>
		</ul>
		<ul>
			<span>关于小米</span>
			<li><a href="javascript:;">了解小米</a></li>
			<li><a href="javascript:;">加入小米</a></li>
			<li><a href="javascript:;">联系我们</a></li>
		</ul>
		<ul>
			<span>关注我们</span>
			<li><a href="javascript:;">新浪微博</a></li>
			<li><a href="javascript:;">小米部落</a></li>
			<li><a href="javascript:;">官方微信</a></li>
		</ul>
		<ul>
			<span>特色服务</span>
			<li><a href="javascript:;">F码通道</a></li>
			<li><a href="javascript:;">礼物码</a></li>
			<li><a href="javascript:;">防伪查询</a></li>
		</ul>
	</div>
	<div class="footer-right">
		<span>400-100-5678</span>
		<p>周一至周日8:00-18:00</p>
		<p>(仅收市话费)</p>
		<a href="javascript:;">24小时在线客服</a>
	</div>
</div>
<div class="footer-bottom">
	<span></span>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<a href="javascript:;">小米商城</a>
	<p>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号
违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</p>
</div>
	</div>
	<script type="text/javascript">
	$(function(){
		var reduce = $('.reduce');
		var add = $('.add');
		var pro_num = $('.pro-num');
		// add.click(function(){
		// 	var num_value = $(this).parent().find(':text').val();
		// 	num_value++;
		// 	$(this).parent().find(':text').val(num_value);
		// });
		// reduce.click(function(){
		// 	var num_value = $(this).parent().find(':text').val();
		// 	if(num_value >= 2){
		// 		num_value--;
		// 		$(this).parent().find(':text').val(num_value);
		// 	}
		// });
		$('.delete').click(function(){
			var oldId = $(this).next().val();
			var It = $(this);
			var validate=true;	
				$.ajax({	
					type: "POST",
					url: "Home/Product/delete_car?action=ajax",
					dataType: "json",	 
					
					data: {"oldId":oldId},
					
					beforeSend: function(){				
					},
					success: function(json){
						if(json.success==1){
							json.success=0;
							//到ajax里this已经变指了,提前存一下就能用了!!!
							It.parent().parent().fadeOut();
							validate=false;
						}else if(json.success==0){
							alert('删除失败！');
							validate=false;
						}else{
							alert("AjaxWrong!!");
						}
					}
			});
			if(!validate){
				return;
			}
		})
	});
	</script>
</body>
</html>